import React from 'react';
import {Form, Input} from 'antd';
import { WeaBrowser } from 'ecCom';
const FormItem = Form.Item;

import FormGroup from './base/FormGroup';
import FormItem4Title from './base/FormItem4Title';

// 文档内容
export default class Content_25 extends React.Component {
    constructor(props) {
        super(props);
        this.onChange = this.onChange.bind(this);
    }
    onChange(ids,names,datas){           
        this.props.form.setFieldsValue({'eContentDocContentForm': ids});
    }
    render() {
        const {eShareLevel, eContent} = this.props.data;
        const {eDocContentForm,eDocContentFormIds} = eContent;
        const {getFieldProps} = this.props.form;
        const {formItemLayout} = this.props;
        let eFormItem4DocContentFrom = <div></div>;
        if (eShareLevel == '2') {
            getFieldProps('eContentDocContentForm', {initialValue: eDocContentFormIds || ''});
            eFormItem4DocContentFrom = (
                <FormItem label="内容来源" {...formItemLayout}>
                    <div style={{display: 'inline-block', width: '410px', margin: '5px', verticalAlign: 'middle'}}>
                        <WeaBrowser
                            type={'doccategory'}
                            isMultCheckbox = {true}
                            isSingle={false}
                            replaceDatas={eDocContentForm || []}
                            onChange={this.onChange}
                        />
                    </div>
                </FormItem>
            );
        }

        return (
            <Form horizontal className="esetting-form">
                <FormGroup title="基本信息">
                    <FormItem4Title {...this.props}/>
                    {eFormItem4DocContentFrom}
                </FormGroup>
            </Form>
        );
    }
}